# To compile code for the sliding window detection
MATLAB = /usr/local/MATLAB/R2010b
OPENCV = /home/wzhu/Documents/OpenCV-2.2.0

CXX =icpc -O3
CXXFLAGS = -c -ansi -fexceptions -openmp 
#CXXINCLUDE = -I$(MATLAB)/extern/include -I$(OPENCV)/include/opencv -I$(OPENCV)/modules/core/include -I$(OPENCV)/modules/calib3d/include -I$(OPENCV)/modules/highgui/include -I/home/wzhu/Documents/CarAoT/testCode/detection
#CXXLIBS = -lomp -L$(MATLAB)/bin/glnxa64 -leng -lmx -L$(OPENCV)/build/lib -lopencv_core220 -lopencv_highgui220 -lopencv_calib3d220

CXXINCLUDE = -I$(MATLAB)/extern/include  -I/usr/local/include/opencv -I/usr/local/include -I/home/wzhu/Documents/CarAoT/testCode/detection -I/home/wzhu/Documents/CarAoT/testCode/detection/

CXXLIBS = -lgomp -Wl,-rpath-link,$(MATLAB)/bin/glnxa64 -Wl,-rpath-link,/usr/lib -L$(MATLAB)/bin/glnxa64 -leng -lmx -lut -lmat -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_features2d -lopencv_calib3d -lopencv_contrib -lopencv_legacy  -parallel 
#-ltcmalloc 


all: slidingWindow svm

slidingWindow: UCLAMain.o imgData.o projector.o projectorEx.o projectorCV.o rootNode.o rootNodeSW.o tanOR.o tanORSW.o visualizer.o volAND.o volOR.o activeCurve.o subAR.o
	$(CXX) $(CXXLIBS) UCLAMain.o imgData.o projector.o  projectorCV.o projectorEx.o rootNode.o rootNodeSW.o tanOR.o tanORSW.o visualizer.o volAND.o volOR.o activeCurve.o subAR.o -o slidingWindow


svm: UCLAsvmReweight.o utility.o  imgData.o projector.o projectorEx.o projectorCV.o rootNode.o rootNodeSW.o tanOR.o tanORSW.o visualizer.o volAND.o volOR.o activeCurve.o ./liblinear/tron.o ./liblinear/linear.o ./libsvm/svm.o subAR.o
	$(CXX) $(CXXLIBS) UCLAsvmReweight.o utility.o imgData.o projector.o projectorEx.o projectorCV.o rootNode.o rootNodeSW.o tanOR.o tanORSW.o visualizer.o volAND.o volOR.o activeCurve.o ./liblinear/tron.o subAR.o ./liblinear/linear.o ./libsvm/svm.o -o svm
	
activeCurve.o: activeCurve.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) activeCurve.cpp -o activeCurve.o

utility.o: utility.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) utility.cpp -o utility.o

LRReweight.o: LRReweight.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) LRReweight.cpp -o LRReweight.o 

svmReweight.o: svmReweight.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) svmReweight.cpp -o svmReweight.o

UCLAsvmReweight.o: UCLAsvmReweight.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) UCLAsvmReweight.cpp -o UCLAsvmReweight.o	

UCLAMain.o: UCLAMain.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) UCLAMain.cpp  -o UCLAMain.o	

imgData.o: imgData.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) imgData.cpp -o imgData.o

projector.o: projector.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) projector.cpp -o projector.o

projectorCV.o: projectorCV.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) projectorCV.cpp -o projectorCV.o

projectorEX.o: projectorEx.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) projectorEx.cpp -o projectorEx.o

rootNode.o: rootNode.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) rootNode.cpp -o rootNode.o

rootNodeSW.o: rootNodeSW.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) rootNodeSW.cpp -o rootNodeSW.o

tanOR.o: tanOR.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) tanOR.cpp -o tanOR.o
	
tanORSW.o: tanORSW.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) tanORSW.cpp -o tanORSW.o
	
visualizer.o: visualizer.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) visualizer.cpp -o visualizer.o

volAND.o: volAND.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) volAND.cpp -o volAND.o

volOR.o : volOR.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) volOR.cpp -o volOR.o

subAR.o : subAR.cpp
	$(CXX) $(CXXFLAGS) $(CXXINCLUDE) subAR.cpp -o subAR.o
	
clean: 
	rm -rf *.o slidingWindow svm reweight
